package com.gxa.service.impl;

import com.gxa.mapper.ExrecordMapper;
import com.gxa.mapper.RerecordMapper;
import com.gxa.service.RerecordService;
import com.gxa.vo.HosrerecordVo;
import com.gxa.vo.OrderremsgVo;
import com.gxa.vo.OutrerecordVo;
import com.gxa.vo.PatientmsgVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RerecordServiceImpl implements RerecordService {

    @Autowired
    private RerecordMapper rerecordMapper;

    @Override
    public List<OutrerecordVo> queryAll() {
        List<OutrerecordVo> outrerecordVos = this.rerecordMapper.queryAll();
        return outrerecordVos;
    }

    @Override
    public List<OutrerecordVo> selectAll(String begintime,String endtime ,String namecard) {
        List<OutrerecordVo> outrerecordVos = this.rerecordMapper.selectAll(begintime,endtime,namecard);
        return outrerecordVos;
    }

    @Override
    public List<PatientmsgVo> queryAllpmsg(String medcard) {
        List<PatientmsgVo> patientmsgVos = this.rerecordMapper.queryAllpmsg(medcard);
        return patientmsgVos;
    }

    @Override
    public List<OrderremsgVo> queryAllomsg(String ordernum) {
        List<OrderremsgVo> orderremsgVos = this.rerecordMapper.queryAllomsg(ordernum);
        return orderremsgVos;
    }

    @Override
    public void updateRemark(String ordernum, String remark) {
        this.rerecordMapper.updateRemark(ordernum,remark);
    }

    @Override
    public List<HosrerecordVo> queryAllHos() {
        List<HosrerecordVo> hosrerecordVos = this.rerecordMapper.queryAllHos();
        return hosrerecordVos;
    }

    @Override
    public List<HosrerecordVo> selectAllHos(String begintime,String endtime, String namehospitalcard) {
        List<HosrerecordVo> hosrerecordVos = this.rerecordMapper.selectAllHos(begintime,endtime,namehospitalcard);
        return hosrerecordVos;
    }

    @Override
    public Integer selectBalance(int id) {
        Integer balance = this.rerecordMapper.selectBalance(id);
        return balance;
    }

    @Override
    public void rechargeBalance(int id, int money) {
        Integer balance = this.rerecordMapper.selectBalance(id);
        this.rerecordMapper.rechargeBalance(id,balance+money);

    }
}
